/**
 * 
 */
package co.fitstart.admin.service;


import java.util.List;
import java.util.Map;

import co.fitstart.admin.entity.search.PrincipalSearch;
import co.fitstart.entity.coach.PrincipalReportRelation;
import co.fitstart.entity.principal.Principal;
import co.fitstart.entity.principal.PrincipalType;
import co.fitstart.entity.site.Site;

import com.demo2do.core.support.Page;

/**
 * @author Downpour
 * @author Leo
 */
public interface PrincipalService extends DataService<Principal> {
    
    /**
     * list principal by type
     * 
     * @param type
     * @param page
     * @return
     */
    public List<Principal> list(PrincipalType type, Page page);
    
    /**
     * 
     * @param principalSearch
     * @param page
     * @return
     */
    public List<Principal> searchForAdminOrRoot(PrincipalSearch principalSearch, Page page);
    
    /**
     * 
     * @param principalSearch
     * @param page
     * @return
     */
    public List<Principal> searchForAreaManager(PrincipalSearch principalSearch, Page page);
    
    /**
     * 
     * @param principalSearch
     * @param page
     * @return
     */
    public List<Principal> searchForSiteManagerOrAreaServer(PrincipalSearch principalSearch, Page page);
    
    /**
     * list principal by principalSearch
     * @param principalSearch
     * @param page
     * @return
     */
    public List<Principal> search(PrincipalSearch principalSearch, Page page);
    
    /**
     * 
     * @param code
     * @param type
     * @param page
     * @return
     */
    public List<Principal> list(boolean code, PrincipalType type, Page page);
    
    /**
     * List principal by site
     * 
     * @param site
     * @param page
     * @return
     */
    public List<PrincipalReportRelation> listRelation(Site site, Page page);
    
    /**
     * List principal by sites
     * @param sites
     * @param page
     * @return
     */
    public List<Principal> listForAreaManager(List<Site> sites, Page page);
    
    /**
     * 
     * @param sites
     * @param page
     * @return
     */
    public List<Principal> listForAreaServer(List<Site> sites, Page page);
    
    /**
     * List principal by principalSearch
     * @param principalSearch
     * @param page
     * @return
     */
    public List<PrincipalReportRelation> searchRelation(PrincipalSearch principalSearch, Page page);
    
    /**
     * 
     * @param coach
     * @return
     */
    public List<PrincipalReportRelation> listRelation(Principal coach);
    
    /**
     * 
     * @param coach
     * @param manager
     * @return
     */
    public PrincipalReportRelation loadRelation(Principal coach, Principal manager);

    /**
     * 
     * @param coach
     * @param managerIds
     */
    public void editRelation(Principal coach, List<Long> managerIds);
    
    /**
     * 
     * @param principal
     */
    public void create(Principal principal);
    
    /**
     * 
     * @param coach
     * @param weixinid
     * @param manager
     */
    public void createCoach(Principal coach, String weixinid, Principal manager);
    
    /**
     * 
     * @param siteAssist
     * @param site
     */
    public void createSiteAssist(Principal siteAssist, Site site);
    
    /**
     * changes password
     * 
     * @param principal
     * @param password
     */
    public void changePassword(Principal principal, String password);
    
    /**
     * reset principal's password
     * 
     * @param principal
     */
    public void resetPassword(Principal principal);
    
    /**
     * 
     * @param principal
     * @return
     */
    public PrincipalReportRelation getRelation(Principal principal);
    
    /**
     * 
     * @return
     */
    public Map<Long, Principal> listSiteManager();
    
    /**
     * load site manager by site
     * @param site
     * @return
     */
    public Principal loadSiteManager(Site site);
    
    /**
     * 
     * @param areaManager
     * @param sites
     */
    public void createAreaManager(Principal areaManager, List<Site> sites);
    
    /**
     * 
     * @param principal 大店长 or 运营主管
     * @param sites
     */
    public void editManagedSites(Principal principal, List<Site> sites);
    
    /**
     * 
     * @param principal
     * @return
     */
    public PrincipalReportRelation loadRelation(Principal principal);
    
    /**
     * 
     * @param areaServer
     * @param sites
     */
    public void createAreaServer(Principal areaServer, List<Site> sites);
    
    /**
     * 
     * @param siteManager
     * @param site
     */
    public void createSiteManager(Principal siteManager, Site site);
    
    /**
     * 
     * @param principal
     */
    public void changeStatus(Principal principal);
    
    /**
     * 
     * @param principal
     * @param site
     */
    public void changeSite(Principal principal, Site site);
}
